/**
 * @file      task_audio.h
 * @brief    audio playing task
                 support beep and wav file
                 wav file format: single channel/32000/16bit PCM
 * @author    - Adela 
 *            - Robert Zhang <armner@gmail.com>
 *            - 
 */

 #ifndef _TASK_AUDIO_H_
#define	_TASK_AUDIO_H_

#include "FreeRTOS.h"
#include "semphr.h"
#include "queue.h"

#define TASK_AUDIO_STACK_SIZE (512)

void taskAudio(void * pData);
extern xQueueHandle queueAudio;

typedef struct t_BEEP
{
    unsigned int freq;
    unsigned int duaration;
} Beep;

typedef struct 
{
    int prim;
    unsigned short volume;
    union{
	 Beep beep;
        char name[20];
    }data;
} AudioMail;

#define PRIM_AUDIO_PLAY_FILE (0)
#define PRIM_AUDIO_PLAY_BEEP (1)

#define SAMPLE_RATES (32000)
#define SAMPLE_POINTS 512



extern void playBeep(int freq, int ms, int volume);
extern void playFile(char *filename, int volume);

#endif



